# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------#
# testEdict.py
# Lars Yencken <lars.yencken@gmail.com>
# vim: ts=4 sw=4 sts=4 et tw=78:
# Fri Dec  8 15:52:07 2006
#
#----------------------------------------------------------------------------# 

import unittest
from edict import *

#----------------------------------------------------------------------------#

def suite():
    testSuite = unittest.TestSuite((
            unittest.makeSuite(EdictTestCase)
        ))
    return testSuite

#----------------------------------------------------------------------------#

class EdictTestCase(unittest.TestCase):
    """ This class tests the Edict class. 
    """
    def setUp(self):
        pass

    def testDictionaries(self):
        """ Tests for the presence of edict and j_places.
        """
        dicts = listDictionaries()
        assert 'je_edict' in dicts
        assert 'je_jplaces' in dicts
        return

    def testEdict(self):
        """ Tests several simple lookups.
        """
        edictDict = getDictionary('je_edict')
        entry = edictDict[u'日本学']
        self.assertEqual(entry.kanji, u'日本学')
        self.assertEqual(entry.reading, u'にほんがく')
        assert u'Japanology' in entry.meaning
    
    def tearDown(self):
        pass

#----------------------------------------------------------------------------#

if __name__ == "__main__":
    unittest.TextTestRunner(verbosity=1).run(suite())

#----------------------------------------------------------------------------#

# vim: ts=4 sw=4 sts=4 et tw=78:

